﻿@model WebSite.Models.MainPageVM

@section SEOContent {
    <title>@Model.Layout.PageTitle</title>
    <meta name="description" content="@Model.Layout.Description"/>
    <meta name="keywords"    content="@Model.Layout.KeyWords" />
    <meta name="robots"      content="index,follow">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
}

<h1>
    @Model.Layout.TitleH1
</h1>
<div id="home">
    @Html.Raw(@Model.Layout.Markup)
    <div id="recent">
        @foreach (WebSite.Models.MainPageVM.MainPageItemVM item in @Model.PageItems)
        {
            RouteValueDictionary args = null;
            if(!String.IsNullOrEmpty(item.DestinationActionParams))
            {
                args = new RouteValueDictionary();
                String[] chunks = item.DestinationActionParams.Split(';');
                if (chunks == null || chunks.Length == 0)
                {
                    chunks = new String[] { item.DestinationActionParams };
                }
                foreach (String paramPair in chunks)
                {
                    String[] pArr = paramPair.Split('=');
                    if (pArr != null || pArr.Length == 2)
                    {
                        args.Add(pArr[0], pArr[1]);
                    }
                }
            }
            
            <div class="project @item.ItemCss">
                <a class="thumb" href="@Url.Action(item.DestinationAction,item.DestinationController,args)">
                    <img width="412" height="200" alt="" src="@item.ImgUrl"/>
                    <div>@item.ItemTitle</div>
                </a>
                <div class="info">
                    @item.ItemText
                    <a href="@Url.Action(item.DestinationAction,item.DestinationController,args)">детальнее...</a>
                </div>
            </div>
        }
    </div>
</div>
